<template>
  <div class="staffHomePoem.vue">
    <div v-if="!$store.state.isbusNewsDitle">
      <div
        v-for="item in pomeList"
        :key="item.id"
      >
        <div class="poem_img">
          <img
            src="../../../assets/imges/wzhixian.png"
            alt=""
          >
        </div>
        <div class="poem_box">
          <div class="pome_title_box">
            <i class="yuan"></i>
            <span
              @click='handDitle(item)'
              class="pome_title pointer"
            >{{item.title}}</span>
          </div>
          <span class="pome_name">{{item.author}}</span>
        </div>
      </div>
      <div
        class="page_box"
        style="margin-top: 70px;margin-bottom:30px;"
      >
        <el-pagination
          @size-change="handleSizeChange"
          @current-change="handleCurrentChange"
          :page-sizes="[5,10,15]"
          :page-size="pageBid3.limit"
          layout="total, prev, pager, next, jumper"
          :total="pageBid3.totalCount"
        >
        </el-pagination>
      </div>
    </div>
    <transition name="fade">
      <div
        v-if="$store.state.isbusNewsDitle"
        class="busDitle_dog"
      >
        <mydetails
          :sonList="pomeList"
          :dateils="dateils"
        ></mydetails>
      </div>
    </transition>

  </div>
</template>

<script>
import myDetails from "../../../components/details";
export default {
  components: {
    myDetails
  },
  props: {
    pomeList: {
      type: Array
    },
    sonid: {
      type: Number
    }
  },
  name: "staffHomePoem.vue",

  data() {
    return {
      sheyingList: [],
      pageBid3: {
        start: 1,
        limit: 10,
        totalCount: 0,
        tatalpage: 0
      }
    };
  },
  mounted() {
    this.$api.getList({ sortId: this.sonid, page: 1, limit: 10 }).then(res => {
      this.sheyingList = res.data.data;
      this.pageBid3.totalCount = res.data.count;
      this.sheyingList.forEach(item => {
        item.img = item.img.replace(/\\/g, "/");
        item.img = this.$store.state.baseUrl + item.img;
      });
    });
  },
  methods: {
    init(page) {
      this.$api
        .getList({ sortId: this.sonid, page: page, limit: 10 })
        .then(res => {
          this.sheyingList = res.data.data;
          this.sheyingList.forEach(item => {
            item.img = item.img.replace(/\\/g, "/");
            item.img = this.$store.state.baseUrl + item.img;
          });
        });
    },
    handDitle(item) {
      this.dateils = item;
      this.$store.commit("handBus", true);
    },
    handleSizeChange() {},
    handleCurrentChange(val) {
      this.init(val);
    }
  }
};
</script>

<style lang='scss' scoped>
.poem_box {
  font-size: 16px;
  color: #333333;
  display: flex;
  justify-content: space-between;
  padding: 14px 18px;
  .pome_title_box {
    display: flex;
    align-items: center;
    .pome_title:hover {
      color: #1792cf !important;
    }
    .pome_title {
      margin-left: 20px;
    }
  }
}
.poem_img {
  text-align: center;
}
</style>
